package common.tryBlock;

/**
* @desc 　测试　autoClose
 * https://www.cnblogs.com/webor2006/p/8405511.html
* @author kanggw
* @datetime 2021/9/18,11:44 上午
*/
public class AutoCloseTest implements AutoCloseable{

    @Override
    public void close() throws Exception {
        System.out.println("**invoke close**");
    }

    public void doSomeThing() {

        System.out.println("**doSomeThing**");
    }

    public static void main(String[] args) {

        try (AutoCloseTest closeTest = new AutoCloseTest()) {
            closeTest.doSomeThing();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
